package com.yuanfeng.job.job;


import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.job.service.JobOrderNotCompletedService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author lxt
 *统计为完成订单 月度订单
 */
public class NotCompletedJobimplementsJob implements BaseJob {

	private static final Logger logger = LoggerFactory.getLogger(SalesPromotionsJob.class);
	@Autowired
	private JobOrderNotCompletedService jobOrderNotCompletedService;

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		// TODO Auto-generated method stub
		SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM");
		Calendar c = Calendar.getInstance();
		c.setTime(new Date());
		c.add(Calendar.MONTH, -1);
		Date m3 = c.getTime();
		String finishTime = dateformat.format(m3);
		logger.info("本次插入未完成订单，开始时间:" + finishTime);
		ResponseResult staut = jobOrderNotCompletedService.insertNotCompletedJobimplements(finishTime);

	}

}
